package com.itheima.Demo3;

import java.util.Arrays;
import java.util.Comparator;

public class test {
    public static void main(String[] args) {
        String []name={"张三", "李四", "王五","ADB", "CDE", "EFG", "HIJ", "KLM", "NOP", "QRS", "TUV","abc", "def", "ghi", "jkl"};
//        Arrays.sort(name, new Comparator<String>() {
//            @Override
//            public int compare(String o1, String o2) {
//                //忽略大小写
//                return o1.compareToIgnoreCase(o2);
//            }
//        });
        //简化
//        Arrays.sort(name,(o1,o2)-> o1.compareToIgnoreCase(o2));
        //特定方法比较 类型名称::方法名
        Arrays.sort(name,String::compareToIgnoreCase);
        System.out.println(Arrays.toString(name));
    }
}
